use cassie_core::config::config::ApplicationConfig;
use cassie_core::fundation::{AppContext, ApplicationContext};
use cassie_mapper::init_database;

/**
 *description:根据路径初始化系统配置
 *author:cassie-lxd<348040933@qq.com>
 */
pub async fn init_db() {
  let c = ApplicationContext::get_service::<ApplicationConfig>();
  if let Some(cof) = c {
    let cassie_config = cof.lock().unwrap();
    let rb = init_database(cassie_config.database());
    ApplicationContext::set_service(rb);
  }
}
